home *** CD-ROM | disk | FTP | other *** search
- ' ***************************************************************
- ' * CheckPing.vbs *
- ' * By Vittorio Pavesi (www.vittorio.tk) *
- ' * *
- ' * Check number of active Terminal Server Sessions *
- ' ***************************************************************
-
- CheckPing("192.168.15.21")
-
- Sub CheckPing(host)
- result = "Error"
- Set obj1 = WScript.CreateObject("WScript.Shell")
- Set obj2 = obj1.Exec("cmd /c ping -n 4 -w 1000 " & host)
- Do While Not obj2.StdOut.AtEndOfStream
- strText = obj2.StdOut.ReadLine()
- If Instr(strText, "Reply") > 0 Then
- result = "OK"
- Exit Do
- End If
- Loop
- Wscript.Echo Result & vbcrlf & strText
- End Sub